﻿using Microsoft.IdentityModel.Tokens;
using System.Text;

namespace PesticideManage.API.Services.JWT;

public class JwtOptions
{
    public const string Name = "JWT";
    public readonly static double DefaultExpiresMinutes = 30d;
    //public readonly static int RefreshTokenExpiresDays = 1;

    public string? Audience { get; set; }
    public string SigningKey { get; set; } = null!;

    public string? Issuer { get; set; }
    public SymmetricSecurityKey SymmetricSecurityKey => new SymmetricSecurityKey(Encoding.UTF8.GetBytes(SigningKey));
    /// <summary>
    /// 过期时间
    /// </summary>
    public double ExpiresMinutes { get; set; } = DefaultExpiresMinutes;
    /// <summary>
    /// 刷新令牌过期天数
    /// </summary>
    public int RefreshTokenExpiresDays { get; set; } = 3;
    /// <summary>
    /// 令牌过期分钟数
    /// </summary>
    public int AccessTokenExpiresMinutes { get; set; } = 30;
}